from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from timelineapp.views import home, list_timelines, create_timeline, show_timeline, edit_timeline, import_events
from userapp.views import create_user, show_user, edit_user, delete_user, list_user_events, list_user_timelines, login, logout
from eventapp.views import add_event_to_timeline, add_assets_to_event, search_events, add_event, edit_event
from votingapp.views import vote, display_user_events_approved, display_user_events_nonapproved, select_timeline
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    
    url(r'^admin/$', include(admin.site.urls)),
    
    url(r'^$', home),
    
    url(r'^timelines/$', list_timelines),
    url(r'^timelines/new$', create_timeline),
    url(r'^timelines/(\d+)$', show_timeline),
    url(r'^timelines/(\d+)/edit$', edit_timeline),
    url(r'^timelines/(\d+)/import_events$', import_events),
    url(r'^timelines/(\d+)/vote', vote),
    
    url(r'^vote', select_timeline),
    
    url(r'^timelines/(\d+)/events/search$', search_events),
    url(r'^timelines/(\d+)/events/new$', add_event),
    url(r'^timelines/(\d+)/events$', add_event_to_timeline),
    url(r'^timelines/(\d+)/events/(\d+)/edit$', edit_event),
    url(r'^timelines/(\d+)/events/(\d+)/assets$', add_assets_to_event),
    
    url(r'^user/login$', login),
    url(r'^user/logout$', logout),
    url(r'^user/new$', create_user),
    url(r'^user/$', show_user),
    url(r'^user/edit$', edit_user),
    url(r'^user/delete$', delete_user),
    url(r'^user/events$', list_user_events),
    url(r'^user/timelines$', list_user_timelines),
    url(r'^user/events/approved$', display_user_events_approved),
    url(r'^user/events/nonapproved', display_user_events_nonapproved),
)

urlpatterns += staticfiles_urlpatterns()